home *** CD-ROM | disk | FTP | other *** search
Text File | 1986-01-07 | 34.0 KB | 1,030 lines | [TEXT/MACA] |
-
- True BASIC, Inc.
- 39 South Main Street
- Hanover, N.H. 03755
-
- (603) 643-3882
-
-
- Demo System
-
-
- True BASIC is a new version of BASIC developed by John Kemeny and
- Tom Kurtz -- BASIC's original inventors. It's a modern version
- of BASIC which includes control structures, subroutines, and
- powerful graphics. Best of all, True BASIC is based on the proposed
- American National Standard for BASIC and is thus the same on
- all brands of computers.
-
- The True BASIC Demo Disk System is a is a scaled-down, working
- copy of the True BASIC Language System. Your demonstration disk
- contains almost exactly the same contents as the full system, except that
- the language system has been trimmed back in a few ways.
-
- The full True BASIC Language System includes the Language System
- software, plus a User's Guide and Reference Manual. The User's Guide
- provides an easy and comprehensive introduction to the language,
- and also describes exactly how to use True BASIC on your computer.
- The Language System disk contains many small tutorial programs keyed
- to the User's Guide. The Reference Manual is the same for every
- computer, and describes the language in detail.
-
-
- Demo Disk System Limits
-
- The Demo Disk System has a few limits that aren't found in the
- full Language System. Here's a list.
-
- o Program Size
-
- Programs can be up to 100 lines long in the Demo Disk System.
- The full Language System allows any size program that will fit in
- your computer's memory. (Unlike many other programs, True BASIC
- can use the full memory provided on your computer.)
-
- The Demo Disk System also restricts your program's compiled
- size to no more than 1000 bytes, and allows no more than four
- external subroutines, functions, or pictures. No such restrictions exist
- in the full Language System.
-
- o Saving and Printing Files
-
- The Demo Disk System does not allow you to save or print files. The
- full Language System does (of course!).
-
- o File Output
-
- You may open and use files within the Demo Disk System. However,
- all file output is forbidden. The full Language System provides
- complete support for text files, random access ``record'' files,
- and low-level ``byte'' files.
-
- o Chaining and Uncompiled Libraries
-
- The Demo Disk System does not let you use True BASIC's CHAIN
- statement, or use source file libraries of subroutines. The
- full Language System provides a CHAIN command, and lets you
- use compiled or uncompiled libraries as ``toolboxes'' of subroutines
- and functions.
-
- o The DO Command
-
- The Demo Disk System disallows True BASIC's ``DO'' command,
- which lets you run preprocessors, formatters, or pretty-printers
- over your source program. The full Language System supplies
- several predefined DO programs, and also lets you write your own.
-
-
- Ordering the Language System
-
- If you want to order a copy of the Language System, contact your
- nearest dealer or give us a call. You'll have your copy within
- a day or two. While you're at it, ask about our special libraries.
- Whether you're sorting lists, managing forms on your screen,
- or keeping track of data bases, our ``off the shelf'' libraries
- can make your job easier.
-
-
-
- Getting Started
-
- Turn on your Macintosh, and insert your True BASIC ``Demo Disk.''
- After a while, your screen should show two open folders. Double click on
- the True BASIC icon, and True BASIC will start running.
-
- For practice, try typing in the following simple program. Remember to press
- then Return key at the end of each line. If you make a typing mistake, use
- the Backspace key to erase the mistake. True BASIC supports all the standard
- Macintosh editing techniques. Thus you can move the insertion point by
- clicking with the mouse, highlight words by double clicking, and so forth.
-
- for i = 1 to 10
- print i
- next i
- end
-
- Make sure that you've typed everything correctly, and then select Run
- from the Run menu. The screen will go blank, and then your program will
- run. It prints the numbers one through 10. Since you didn't have an
- output window open, True BASIC automatically used the whole screen.
- Press any key, or click the mouse, to return to the editing window.
-
- You may also run programs by clicking on the bottom ``green'' light in
- the traffic light icon, or by holding down the Command key and pressing
- R. Try both.
-
- Now let's deliberately introduce a few errors into this program. Edit
- your program so it looks like this:
-
- for i = 1 to
- print i/0
- next n
-
- Try running this program. Since it's full of errors, the True BASIC
- compiler points them out. Notice how it automatically brings the cursor
- to the bad spot, and then displays the error message in the ``error bar''
- at the bottom of your program window. Correct the first error, and then
- click on the error bar. Since the compiler found more errors, it will
- then bring the cursor to the next error, and print an error message.
- Correct it, and click on the error bar again. Continue this until the
- error bar goes blank.
-
- Then select Run again. This time the compiler does not object, since
- you've fixed all the obvious errors. The screen goes blank, but then
- immediately reverts to the program window. Dividing by zero is a
- runtime error. Again, True BASIC shows a message in the error bar,
- and brings the cursor to the bad line.
-
- The Output and Command Windows
-
- Click on the Output window icon in the control box. True BASIC opens
- an output window. Now remove the division by zero from your program,
- and run it again. All output appears
- in the little output window. Try using the Output window's scroll bars
- to look backward through the output. Notice that True BASIC keeps
- a little bit of history.
-
- Now click on the Command window icon. True BASIC opens a window
- in which you can type commands. Try running your program by typing
- ``run'' and pressing Return. Some people prefer typing commands, and
- some prefer using the mouse and menu. True BASIC accepts both.
- True BASIC commands are the same on every computer. Try scrolling
- back through the command window, and you'll see that True BASIC keeps
- some history of which commands you've given, and which error messages
- you're received.
-
- You can tidy up the screen by ``tiling'' all three windows. Hold down
- the Command key and resize the editing window (by dragging its size
- box). The other two windows will shift to make best use of the screen.
- You might as well close the Command window now, to avoid cluttering
- the screen.
-
- Horizontal Scrolling
-
- Resize the editing window to make it very narrow, so some lines are
- wider than the window. Notice that the window does not have horizontal
- scroll bars. This is because BASIC programs are different than English
- text. It makes sense to scroll an entire paragraph sideways, but
- it doesn't make sense to scroll a whole True BASIC program.
- Each line stands on its own.
-
- To scroll an individual line, move the mouse to the left (or right)
- edge of the line, and drag from the text out beyond the edge of the
- window. The line will start scrolling sideways. When you get to
- where you want, let the mouse button up. Then click somewhere in
- the line to turn off the highlighting. To put a line back to
- normal, just click anywhere in another line.
-
-
-
- Advanced Editing
-
- Call up the program Lissa Box from your disk. (Select the Open menu
- item from the Files menu, and then pick Lissa Box from the list of
- filenames shown.) Make sure you have a small Output window, and
- then run the program.
-
- Lissa Box doesn't stop until you tell it to. To stop a True BASIC
- program, select Stop from the Run menu. If the stoplight is visible,
- you can also stop programs by clicking on the red light. Or you
- can use the yellow light to ``freeze'' the screen; True BASIC will
- wait until you click the green light, or press any key, and then
- will continue.
-
- Immediate Mode
-
- When you've stopped Lissa Box, open the Command window. Type the
- command ``print x'' and press Return. True BASIC will show you the
- current value of x. You can use most True BASIC statements as
- commands; this lets you inspect and alter variable values. Type
- ``continue'' and press Return to resume the program. Or click on
- the yellow light and then the green light.
-
- Cut, Copy, and Paste
-
- The Edit menu contains the Macintosh standard Cut, Copy, and Paste
- menu items. They work as you would expect. True BASIC uses the
- Macintosh clipboard for its cutting and pasting, so you can exchange
- text with other applications through the clipboard.
-
- Editing Individual Routines
-
- Lissa Box contains a subroutined named Reset. You can narrow the focus
- of your editing to a single subroutine by using the Edit menu item
- from the Edit menu. Select Edit. True BASIC will present a dialog
- box asking the name of the block to edit. You may type either a
- range of line numbers, or the name of a subroutine. Type ``Reset''
- and press Return. True BASIC will then restrict editing to this
- subroutine.
-
- Try using the scroll bars. You can't move out of the Reset subroutine.
- Now use the Change menu item (from Search) to change all occurences
- of LET to XXX. Select Change. When the dialog box appears, type
- LET, press the Tab key, and then type XXX. Then click on the OK
- button. True BASIC will make the changes. Since you've decided to
- edit only the Reset subroutine, True BASIC will make changes only within
- this routine.
-
- To see the whole program again, select Edit and simply click on OK
- without typing anything. True BASIC will go back to editing your entire
- program.
-
- Include and Keep
-
- The Include menu item, in the Edit menu, copies a saved file into your
- current program. Select Include. You will be shown a list of filenames.
- Pick ``Cars.'' It will be inserted into your current program, starting at
- the line immediately after the line containing the insertion point.
-
- The Keep menu item throws away all but some block of lines. Select
- Keep from the Edit menu, and reply Reset to its dialog box. Click on OK.
- True BASIC will discard all but that subroutine. You can also select
- a block of lines by dragging the mouse across it, and then use Keep
- to keep only that block of lines. Give it a try. True BASIC will
- ask to make sure you want to keep only those lines.
-
- Fonts
-
- Each True BASIC window has its own font size. Click on a window, and
- then select a font size from the Fonts menu. True BASIC will change
- the size of type used within that window. Big type is good for
- classroom demonstrations, small type fits more of a program on the
- screen. Medium is probably the most comfortable.
-
-
-
- True BASIC vs. older BASICs
-
- John Kemeny and Tom Kurtz invented BASIC in 1964. That's the
- BASIC used on most microcomputers. Now they've teamed
- up again to reinvent a BASIC for the 1980s -- True BASIC. As you would
- expect, it keeps what's good from older BASICs. But it also adds
- many new features.
-
- All Your Old Favorites
-
- True BASIC keeps all the comforts of older BASICs. The LET, PRINT,
- INPUT, READ, DATA statements, and so forth, all work as you would
- expect. As in older BASICs, two types of variables exist: numbers
- and strings. You don't have to learn a new language to start
- programming in True BASIC.
-
- Only one thing might come as a surprise: the LET keyword is
- required in True BASIC, in order to keep the number of reserved
- words manageably small.
-
- Line Numbers
-
- True BASIC's complete set of modern control structures make line
- numbers unnecessary. Therefore you can write True BASIC programs
- without any line numbers. However, you can still use line numbers
- if you wish.
-
- If one line has a line number, then all lines must be numbered.
- The range of legal numbers is from 1 to 99999.
-
- Numbers and Strings
-
- Expressions are computed to at least 10 digits of accuracy on all
- computers. Most computers, such as the IBM PC and the Apple Macintosh,
- provide more accuracy -- about 14 digits worth. If you run True BASIC
- on an IBM PC equipped with an 8087 floating point processor, True BASIC
- will automatically use the 8087 for arithmetic (and give 16 digits of
- accuracy for all expressions).
-
- True BASIC strings can be up to 32,000 characters long on all computers.
- Some computers support longer strings; for example, the Apple Macintosh
- version of True BASIC allows strings up to 1 megabyte long.
-
- Arrays may have any number of elements. The only restriction is that
- the entire array must fit in memory. You must use a DIM statement
- for every array, and the DIM statement must appear somewhere before
- the array's first use.
-
- Many programs use integers for fast computations. Unlike older
- BASICs, True BASIC can automatically determine which variables contain
- integer values, and runs faster in those cases. Yet you never need
- to explicitly say which variables are integers! In fact, True BASIC
- doesn't let you add a ``%'' to variable names. Just sit back and
- let the language do the optimizations for you.
-
- Expressions and Substrings
-
- True BASIC uses the common +, -, *, /, and ^ marks for arithmetic.
- For string concatenation and substrings, it follows the Standard
- language. Thus ``&'' (rather than ``+'') stands for string concatenation.
-
- Substrings are indicated by a$[s:e] where s stands for the starting
- position in the string, and e stands for the ending position. You
- can use any expression to stand for s and e. If s < 1, then 1 is
- used instead. If e points past the end of the string, then the
- end of the string is used instead. If s>e, then the substring
- is a null string. You can also assign to substrings; the new
- text replaces the old substring, and the full string grows or
- shrinks as needed.
-
- Comments and Multiple Statements per Line
-
- True BASIC allows the REM statement for comments. It also lets you
- add comments to individual lines. Anything from an exclamation mark ``!''
- to the end of the line is treated as a comment.
-
- True BASIC does not allow multiple statements on a line. The next
- page shows how you can use True BASIC's control structures to
- created IF-THEN statements containing multiple statements.
-
-
-
- Structures
-
- In addition to the older GOTO and GOSUB statements, True BASIC also
- offers real structures. ``Spaghetti code'' is no longer the only
- game in town. Clean, modern control structures let you do it
- right.
-
- Loops
-
- True BASIC has FOR-NEXT loops like older BASICs, but it also introduces
- new ``do while'' and ``do until'' loops. These loops repeat until
- some condition becomes true. You can test the condition at the
- start of the loop, or at the end of the loop -- or both. Or you can
- make tests in the middle of a loop, and skip out.
-
- The general forms of the DO loop are:
-
- DO WHILE test DO UNTIL test
- ... ...
- LOOP LOOP
-
-
- DO DO
- ... ...
- LOOP WHILE test LOOP UNTIL test
-
- where the test can be a relational expression such as ``a<b'' or
- a more complicated logical expression such as ``a<b or (a=1 and b<10)''.
- Loops can have tests on either end, or both. A WHILE condition
- keeps looping while the test is true, and an UNTIL condition keeps
- looping until it's true.
-
- You may add EXIT DO statements anywhere inside a DO loop. When
- True BASIC executes an EXIT DO statement, it immediately jumps out
- of the loop, and begins executing the first statement after the
- LOOP statement.
-
- IF-THEN Structures
-
- The simplest form of IF statement makes a test, and executes some
- statement if the test proves true. A slightly longer form adds
- an ELSE clause, which is executed if the test proves false. These
- statements are written as:
-
- IF test THEN statement
- IF test THEN statement ELSE statement
-
- Longer forms let you put multiple statements in the THEN or
- ELSE parts. These statements spread out over several lines,
- since each True BASIC statement must go on its own line.
-
- IF test THEN
- statements...
- END IF
-
- IF test THEN
- statements...
- ELSE
- statements...
- END IF
-
- You can also form ``chains'' of tests, which are executed in order,
- by using the IF-THEN-ELSE IF statement. This structure must always
- spread out over multiple lines.
-
- IF test1 THEN
- statements...
- ELSE IF test2 THEN
- statements...
- ELSE IF test3 THEN
- statements...
- ELSE
- statements...
- END IF
-
- This form first checks ``test1''. If it's true, True BASIC executes
- the block of statements right after test1, and then skips to the
- statement after the END IF. Otherwise, True BASIC next tests
- ``test2'', and so forth. Finally, if none of the tests are true,
- True BASIC executes the statements in the ELSE part. (You may
- omit the ELSE part, if you wish. If you do, True BASIC will
- simply proceed to the statement after END IF should none of
- the tests prove true.)
-
- SELECT CASE Structures
-
- The SELECT CASE structure lets you outline a list of possible values,
- and check a single variable or expression against them. It selects
- which block of statements to execute based on these lists of
- values. Its form is:
-
- SELECT CASE var
- CASE item, item, ...
- statements....
- CASE item, item, ...
- statements...
- CASE ELSE
- statements...
- END SELECT
-
- First True BASIC computes the value for the SELECT CASE expression.
- Then it tries to match this with the CASE items. Each item can
- be a simple constant, such as ``1''. Or it may be more complicated.
- The legal forms for items are:
-
- constant
- constant TO constant
- IS < constant
-
- WHEN ERROR Structures
-
- Error handling is also structured. You can intercept any error by
- surrounding the troublesome statements with an ``error handler''.
-
- WHEN ERROR IN
- statements...
- USE
- statements...
- END WHEN
-
- The statements between USE and END WHEN are executed only if an
- error crops up in the first block of statements. Otherwise they're
- skipped over. The Extype function returns a numeric error code
- for the error that occured; the Extext$ function returns the
- associated error messages.
-
- You can cause your own error conditions, with customized error
- messages, by using the CAUSE ERROR statement. Its format is:
-
- CAUSE ERROR code,message$
-
-
-
- Graphics
-
- True BASIC's graphics are powerful and easy to use.
- Most versions of BASIC require you to specify your drawings in terms
- of ``pixels'', or the glowing dots of phosphor on the computer's screen.
- True BASIC lets you draw points, lines, areas, and text in terms
- of your own problems -- then True BASIC automatically translates
- these coordinates into the computer's pixels.
-
- Since you never directly program in pixels, your programs will run
- on any True BASIC computer -- without change. The same graphics
- program will run on the IBM PC and the Apple Macintosh. And should
- you ever buy an enhanced graphics system, your programs will continue
- to run. They will simply look better, thanks to the superior
- resolution of your new system.
-
- The simplest plotting uses the SET WINDOW and PLOT statements. SET
- WINDOW tells True BASIC what coordinates you choose to work in.
- (It will then translate these coordinates into pixels.) PLOT tells
- True BASIC to draw a point, line, area, or text.
-
- set window 0, 20, -1, 1
- for x = 0 to 20 step .2
- plot x, Sin(x)
- next x
- end
-
- Type in this program and run it. It draws a series of points on your
- screen. The SET WINDOW statement tells True BASIC that you want the
- screen to run from 0 to 20 along the horizontal axis, and from
- -1 to 1 along the vertical axis (since Sin's value always lies
- between -1 and 1).
-
- Add a semicolon to the end of the PLOT statement, to leave the
- beam turned on during plotting.
-
- PLOT x, Sin(x);
-
- Then run this new version. Since the beam was left on, True BASIC
- draws a series of short line segments from each point to the next.
- The result is a sine wave.
-
- Areas
-
- True BASIC can also plot filled ``areas'', or polygons, in a single
- statement. The PLOT AREA statement takes a list of (x,y) points
- in your coordinates, and treats them as the vertices of a polygon.
- Then it draws the whole polygon, with its interior shaded.
-
- PLOT AREA: x1,y1; x2,y2; x3,y3; ...
-
- Colors
-
- True BASIC supports all the colors on your computer. You can specify
- colors by name, which makes your program portable and easy to read.
- Or you can use numbers, which let you get at all the colors on your
- computer. On the Macintosh, True BASIC maps colors to shades of gray,
- since the Macintosh is a black-and-white computer.
-
- SET COLOR name$
- SET COLOR number
-
- You can also set the background color.
-
- SET BACK name$
- SET BACK number
-
- True BASIC accepts the same 10 color names on every brand of computer,
- though on some computers it has to fudge the meanings a little.
-
- ``background'' ``black'' ``white'' ``red''
- ``yellow'' ``green'' ``blue'' ``brown''
- ``cyan'' ``magenta''
-
-
- The BOX Statements
-
- The BOX statements provide extremely fast graphics on rectangular areas
- of the screen. Four different statements are included:
-
- BOX CLEAR x1,x2,y1,y2
- BOX AREA x1,x2,y1,y2
- BOX LINES x1,x2,y1,y2
- BOX CIRCLE x1,x2,y1,y2
-
- BOX CLEAR sets the entire rectangle to the background color. BOX AREA
- sets it to the current foreground color. BOX LINES frames the rectangle
- with lines drawn in the current foreground color. BOX CIRCLE draws
- a circle, or an ellipse, that just fits within the indicated
- rectangle.
-
- True BASIC also supports ``raster ops'' for animation. BOX KEEP
- copies a portion of the screen image into a string. BOX SHOW later
- redisplays this image on the screen. Optional arguments for BOX
- SHOW let you perform any of 16 logical ``raster operations'' when
- redisplaying the image on the screen. (Raster operations range
- from 0 to 15.)
-
- BOX KEEP x1,x2,y1,y2 IN s$
- BOX SHOW s$ AT x1,y1
- BOX SHOW s$ AT x1,y1 USING rasterop
-
-
- Windows
-
- You can open up to 10 independent ``windows'' onto your screen. Windows
- can be used for both text and graphics. True BASIC
- remembers each window's coordinate system, current color, and
- so forth. Furthermore, each window is ``clipped'' so that graphics
- do not extend beyond the window's edges. Windows also scroll independently.
-
- To open a window, you must use an OPEN SCREEN statement, which specifies
- where the window should appear on the computer's screen. These screen
- coordinates are given in a machine-independent form. No matter what
- size screen you have, the lower left corner is always considered (0,0)
- and the upper right corner is (1,1). Once you've opened a window, all
- subsequent screen output goes into that window.
-
- ! Open and use a window.
- !
- open #1: screen .5,1,.5,1
- box lines 0,1,0,1
- for i = 1 to 100
- plot rnd,rnd;
- next i
- end
-
- You can open up to 10 windows at once. To switch between windows, use
- the WINDOW statement. You may close windows by a CLOSE statement; all
- windows close automatically when your program stops.
-
- ! Open and use two windows.
- !
- open #1: screen 0,.2,0,1
- open #2: screen .3,1,.3,.7
- for i = 1 to 100
- window #1
- print i
- window #2
- print i;i^2
- next i
- close #1
- close #2
- end
-
-
-
- Subroutines, Functions, and Libraries
-
- Older BASICs provided only GOSUB for subroutines. True
- BASIC provides full modern support for subroutines. You may give
- them names, pass arguments to them, and even separately compile
- them. Subroutines share their variables with the rest of the
- program, or may have their own ``local'' variables.
-
- Subroutines are defined as follows:
-
- SUB subname
- statements...
- END SUB
-
- Once you've defined a subroutine, you can use it by the CALL
- statement:
-
- CALL subname
-
- You can defined subroutines which take ``parameters'' or dummy variables.
- Parameters are placeholders whose values are filled in whenever the
- subroutine is called. For instance,
-
- SUB MySub(x,y)
- PRINT x+y
- END SUB
-
- defines a small subroutine with two parameters, x and y. This can
- be called from different places within your program, passing
- different arguments which are plugged in instead of x and y.
-
- CALL MySub(1,2)
- CALL MySub(a*b+c,1/2)
-
- Local and Global Variables
-
- True BASIC subroutines may be either ``internal'' or ``external''. Internal
- subroutines come before a program's END statement. External subroutines
- come after the END statement, or are kept in separate ``library'' files.
- There is only one difference between internal and external subroutines.
- Internal subroutines share all their variables with the main program.
- External subroutines share no variables; all their variables are
- local to that subroutine.
-
- Functions
-
- True BASIC also lets you define functions. As in traditional BASIC,
- functions can be defined on one line by a DEF statement. You may
- give functions any legal variable names:
-
- DEF funcname = expression
-
- You can also write functions that spill out over multiple lines.
- These functions begin with DEF statements and end with END DEF
- statements:
-
- DEF funcname
- statements...
- LET funcname = expression
- statements...
- END DEF
-
- Like subroutines, functions can take parameters. Functions can
- also be internal or external, and follow the same rules for
- local and global variables as do subroutines. Function parameters
- are always pased by value in True BASIC, so functions cannot
- change their caller's arguments.
-
- Libraries
-
- You can collect groups of useful functions and/or subroutines into
- ``library'' files. These libraries act like toolboxes. You need
- to define a function or subroutine only once, then place it in a
- library. Then you can use this routine from any program, simply
- by adding a LIBRARY statement that names the library file.
-
- LIBRARY "filename"
-
- The Demo Disk System does not let you use uncompiled libraries;
- however, the full language system allows both compiled and uncompiled
- library files. You may also write functions and subroutines in assembly
- language and use them as True BASIC library files.
-
-
- Built-In Functions
-
- True BASIC comes equipped with an extensive set of functions already
- built into the language. The Reference Manual describes each of
- these functions at length, but here is a quick synopsis. This is
- only a partial list. The True BASIC system disk also contains
- libraries which define all hyperbolic trigonometric functions, both
- in radians and degrees, and further mathematical functions.
-
- Mathematical Functions
-
- Abs(x) Absolute values
- Divide(x,y,q,r) Divide x by y, giving quotient q and remainder r
- Eps(x) Fuzziness of floating point around x
- Exp(x) The number e raised to the power x.
- Int(x) Greatest integer <= x.
- Log(x) Logarithm of x, base e.
- Log2(x) Logarithm of x, base 2.
- Log10(x) Logarithm of x, base 10.
- Max(x,y) Maximum of the two numbers.
- Maxnum Largest number your computer can handle.
- Min(x,y) Minimum of x and y.
- Mod(x,Y) x modulo y.
- Remainder(x,y) Remainder when x is divided by y.
- Rnd Random number between 0 and 1.
- Round(x) x rounded to an integer.
- Round(x,n) x rounded to n decimal digits.
- Sgn(x) Sign (-1, 0, +1) of x.
- Sqr(x) Square root of x.
- Truncate(x,n) x truncated to n decimal digits.
-
-
- Trigonometric Functions
-
- Angle(x,y) Angle between point (x,y) and origin.
- Atn(x) Arctangent of x.
- Cos(x) Cosine of x.
- Deg(x) x radians converted to degrees.
- Pi The number pi.
- Rad(x) x degrees converted to radians.
- Sin(x) Sine of x.
- Tan(x) Tangent of x.
-
-
- String Functions
-
- Chr$(n) Single-character string with ASCII code n.
- Len(a$) Length of a$.
- Lcase$(a$) Lower case version of a$.
- Ltrim$(a) Leading spaces removed from a$.
- Ord(a$) ASCII code for one-character string a$.
- Pos(a$,b$,i) Position of b$ in a$ at or after position i.
- Repeat$(a$,n) a$ repeated n times.
- Rtrim$(a$) Trailing spaces removed from a$
- Str$(n) String version of number n.
- Trim$(a$) Leading and trailing spaces removed from a$.
- Ucase$(a$) Upper case version of a$.
- Using$(fmt$,a) Formatted version of a.
- Val(a$) String a$ converted to number.
-
-
- Date and Time Functions
-
- Date Numeric date in format YYDDD.
- Time Time as seconds past midnight.
- Date$ Current date.
- Time$ Current time.
-
-
-
- True BASIC Syntax Summary
-
-
- ASK Statements
-
- BACK var #n: ACCESS var$
- COLOR var #n: FILESIZE var
- CURSOR var$ #n: MARGIN var
- CURSOR x,y #n: NAME var$
- FREE MEMORY var #n: ORGANIZATION var$
- MARGIN var #n: POINTER var$
- MAX COLOR var #n: RECORD var
- MAX CURSOR x,y #n: RECSIZE var
- MODE var$ #n: ZONEWIDTH var
- SCREEN x1,x2,y1,y2
- WINDOW x1,x2,y1,y2
- ZONEWIDTH var
-
- BOX AREA left, right, bottom, top
- BOX CIRCLE left, right, bottom, top
- BOX CLEAR left, right, bottom, top
- BOX ELLIPSE left, right, bottom, top
- BOX KEEP left, right, bottom, top IN var$
- BOX LINES left, right, bottom, top
- BOX SHOW var$ AT left, bottom
- BOX SHOW var$ AT left, bottom USING expr
-
- CALL Subr(expr1, expr2, ...)
-
- CAUSE ERROR expr
- CAUSE ERROR expr, expr$
-
- CHAIN expr$
- CHAIN expr$, RETURN
- CHAIN expr$ WITH (arg$)
- CHAIN expr$ WITH (arg$), RETURN
-
- CLEAR
-
- CLOSE #expr
-
- DATA item1, item2, ...
-
- DECLARE DEF Func1, Func2, ...
-
- DEF Func(var1, var2, ...) = expr
-
- DEF Func(var1, var2, ...)
- ....
- LET Func = expr
- ....
- END DEF
-
- DIM array(bound, bound, ...), ...
- DIM array(low TO high, low TO high, ...) ...
-
- DO may add WHILE condition to either end of loop (or both)
- .... UNTIL condition
- ....
- LOOP
-
- DRAW Picture
- DRAW Picture WITH trans * trans * ...
-
- END
-
- ERASE #expr
-
- EXIT DEF
- EXIT DO
- EXIT FOR
- EXIT HANDLER
- EXIT SUB
-
- EXTERNAL
-
- FLOOD x,y
-
- FOR var = first TO last STEP size
- ....
- ....
- NEXT var
-
- GET KEY var
-
- GET MOUSE: x, y, state
-
- GET POINT: x, y
-
- GOSUB line-number
- GOTO line-number
-
- IF condition THEN statement1
- IF condition THEN statement1 ELSE statement2
-
- IF condition THEN
- ....
- ....
- END IF
-
- IF condition THEN
- ....
- ....
- ELSE IF condition THEN
- ....
- ....
- ELSE
- ....
- ....
- END IF
-
- INPUT var1, var2, ...
- INPUT PROMPT expr$: var1, var2, ...
- LINE INPUT var1$, var2$, ...
- LINE INPUT PROMPT expr$: var1$, var2$, ...
-
- INPUT statements can be used with files. Add a
- channel number, such as:
-
- INPUT #expr: a$
- LINE INPUT #expr , PROMPT expr$: var1$, var2$, ...
-
- LET var1, var2, ... = expr
- LET var1$[i:j] = expr$
-
- LIBRARY "filename", "filename", ...
-
- MAT array = (expr)
- MAT array = array1 + array2
- MAT array = array1 - array2
- MAT array = array1 * array2
- MAT array = Inv(array1)
- MAT array = Trn(array1)
-
- MAT PLOT AREA: array
- MAT PLOT LINES: array
- MAT PLOT POINTS: array
-
- MAT may also precede any INPUT, PRINT, READ, or WRITE statement.
- If so, the statement reads/writes arrays rather than ordinary variables.
-
- ON expr GOSUB line-number, line-number, ...
- ON expr GOSUB line-number, line-number, ... ELSE line-number
-
- ON expr GOTO line-number, line-number, ...
- ON expr GOTO line-number, line-number, ... ELSE line-number
-
- OPEN #expr: NAME expr$ , ACCESS accmode$
- , CREATE crtmode$
- , ORGANIZATION orgmode$
- , RECSIZE recsize
-
- accmode$ can be "INPUT", "OUTPUT", "OUTIN"
- crtmode$ can be "NEW", "OLD", "NEWOLD"
- orgmode$ can be "TEXT", "RECORD", "BYTE"
-
- OPEN #expr: PRINTER
- OPEN #expr: SCREEN left, right, bottom, top
-
- OPTION ANGLE DEGREES
- OPTION ANGLE RADIANS
- OPTION BASE constant
-
- PAUSE expr
-
- PICTURE Pic(var1, var2, ...)
- ....
- ....
- END PICTURE
-
- PLAY music$
-
- PLOT x1,y1; x2,y2; ...
- PLOT AREA: x1,y1; x2,y2; ...
- PLOT LINES: x1,y1; x2,y2; ...
- PLOT POINTS: x1,y1; x2,y2; ...
- PLOT TEXT, AT x1,y1: expr$
-
- PRINT expr1, expr2, ...
- PRINT expr1; expr2; ...
- PRINT USING format$: expr1, expr2, ...
-
- + print number with leading "+" or "-"
- - print number with leading space or "-"
- $ print number with leading dollar sign
-
- * print leading zeros as "*"
- % print leading zeros as "0"
- # print leading zeros as spaces
-
- , insert comma here if appropriate
- . align decimal point here
- ^ exponent field
- < left justify string
- > right justify string
-
- PROGRAM name
- PROGRAM name(var$)
-
- RANDOMIZE
-
- READ var1, var2, ...
- READ #expr: var1, var2, ...
- READ #expr, BYTES expr: var1, var2, ...
-
- REM
-
- RESET
-
- RESTORE
-
- RETURN
-
- SELECT CASE expr test may be:
- CASE test1, test2, ...
- .... constant
- .... low TO high
- CASE test1, test2, ... IS op constant
- ....
- .... 'op' can be <, =, <>, etc.
- CASE ELSE
- ....
- ....
- END SELECT
-
- SET statements
-
- BACK expr #n: MARGIN expr
- COLOR expr #n: POINTER BEGIN
- CURSOR expr$ #n: POINTER END
- CURSOR line, column #n: POINTER NEXT
- MARGIN expr #n: POINTER SAME
- MODE name$ #n: RECORD expr
- WINDOW x1,x2,y1,y2 #n: RECSIZE expr
- ZONEWIDTH expr #n: ZONEWIDTH expr
-
- SOUND freq, time
-
- STOP
-
- SUB Subr(var1, var2, ...)
- ....
- ....
- END SUB
-
- UNSAVE expr$
-
- WHEN ERROR IN
- ....
- ....
- USE
- ....
- ....
- END WHEN
-
- WINDOW #expr
-
- WRITE #expr: expr1, expr2, ...
-